var detalisNum = 2;

$(document).ready(function() {
	showLoading();
	setBaseUrl();
	$('title', parent.document).html($('title').text());
	search();
	setTimeout(hideLoading, 500);
})
function strToJson(str){
	var json = eval('(' + str + ')');
	return json;
}
function search(){
    // alert(message[0].message);
	var dataMessage = message[0];
	var jsonMessage = strToJson(dataMessage.data);
	$("#stationName").html((jsonMessage && jsonMessage.keyword1 && jsonMessage.keyword1.value) || "XXXX充电站");
	$("#alarmTime").html((jsonMessage && jsonMessage.keyword2 && jsonMessage.keyword2.value) || formatTimes(dataMessage.sendDTTM, "one"));
	$("#alarmSource").html(dataMessage.sendFrom || "未知来源");
	$("#bodyStationDetalis").empty();
	$("#detalis").empty();
	var bodyStationDetalis =
        '<div class="bodyTop">'+
        '<div class="bodyLeft color999">'+ (formatTimes(new Date(), "two")) +'</div>' +
        '<div class="bodyRight">' +
        '<div class="circle fourCircle"></div>' +
        '<div>' +
        '<div class="bodyRightTop lineHeight7">待解决</div>' +
        '<div class="lineHeight3">暂无内容</div>' +
        '</div>' +
        '</div>' +
        '</div>';
	$("#bodyStationDetalis").html(bodyStationDetalis);
	$("#detalis").html('' +
		'<div class="detalisShow" onclick="showDetalis()">查看详细进度</div>' +
		'<div class="detalisShow" onclick="showDetalis()"><img src="images/more1.png"/></div>'
	);
	$("#bodyDetalisPerson").empty();
	var bodyDetalisPerson = '';
	var warningFlag = ["已提醒", "未提醒"];
	for (var i=0; i < userList.length; i++) {
		var userListData = userList[i];
		bodyDetalisPerson += '<div class="personTop">' +
			'<div class="personImg">' +
			'<img src="images/phone1.png"/>' +
			'</div>' +
			'<div class="personName">'+ (userListData.userName || "未知人") +'</div>' +
			'<div class="phoneImg" onmouseover="showImage(\'phone2'+ i +'\', \'phone1'+ i +'\', this);" onmouseout="showImage(\'phone1'+ i +'\', \'phone2'+ i +'\', this);" onclick="phone(\''+ userListData.mobile + '\', \'tel\')">' +
			'<img id="phone1'+ i +'" src="images/phone1.png"/>' +
			'<img id="phone2'+ i +'" src="images/phone2.png" hidden="hidden"/>' +
			'</div>' +
			'<div class="msgImg" onmouseover="showImage(\'msg2'+ i +'\', \'msg1'+ i +'\', this);" onmouseout="showImage(\'msg1'+ i +'\', \'msg2'+ i +'\', this);" onclick="phone(\''+ userListData.mobile + '\', \'sms\')">' +
			'<img id="msg1'+ i +'" src="images/msg1.png"/>' +
			'<img id="msg2'+ i +'" src="images/msg2.png" hidden="hidden"/>' +
			'</div>' +
			'<div class="color9E">' +
            '未提醒' +
            '</div>' +
			'</div>';
	}
	$("#bodyDetalisPerson").html(bodyDetalisPerson);
	$(".weChatBodyDiv").css("height", "65%");
}
function phone(date, flag){
	window.location.href = ''+ flag +'://' + date;
}
function showDetalis(){
	$("#detalis").empty();
    $("#detalis").html('<div class="detalisShow">已显示全部</div>');
}